#!/bin/bash

# 更新源并安装软件

echo "欢迎使用XmBox安装脚本！"

while true
do
    echo "请选择要执行的操作："
    echo "1. 更新软件源"
    echo "2. 安装 Vim"
    echo "3. 安装 VS Code"
    echo "4. 安装 Wine"
    echo "5. 安装 Java"
    echo "6. 安装 Python 3.8"
    echo "7. 安装 SSH"
    echo "8. 退出"

    read choice

    case $$choice in
        1)
            echo "更新软件源..."
            sudo apt update
            echo "软件源更新完成！"
            ;;
        2)
            echo "安装 Vim..."
            sudo apt install vim -y
            echo "Vim安装完成！"
            ;;
        3)
            echo "安装 VS Code..."
            sudo snap install code --classic
            echo "VS Code安装完成！"
            ;;
        4)
            echo "安装 Wine..."
            sudo apt install wine -y
            echo "Wine安装完成！"
            ;;
        5)
            echo "安装 Java..."
            sudo apt install openjdk-8-jdk -y
            echo "Java安装完成！"
            ;;
        6)
            echo "安装 Python 3.8..."
            sudo apt install python3.8 -y
            echo "Python 3.8安装完成！"
            ;;
        7)
            echo "安装 SSH..."
            sudo apt install openssh-server -y
            echo "SSH安装完成！"
            ;;
        8)
            echo "好的，再见！"
            break
            ;;
        *)
            echo "选择无效，请重新选择。"
            ;;
    esac

    echo
done